package com.itheima01;

import java.util.ArrayList;
import java.util.Iterator;

public class Test02 {
    public static void main(String[] args) {
        ArrayList<Student> s1=new ArrayList<>();
        s1.add(new Student("张三",28));
        s1.add(new Student("李四",24));
        s1.add(new Student("王五",26));
        Iterator<Student> iter = s1.iterator();
        while (iter.hasNext()) {
            Student next = iter.next();
            System.out.println(next);
        }
        System.out.println("------------");

        for (Student student : s1) {
            System.out.println(student);
        }
        System.out.println("------------");


        s1.forEach(s-> System.out.println(s));
    }
}
